﻿#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>

typedef double Real;


typedef struct
{
	int n;
	int v[10];
}Context;
Context context = { 0 };


void read_data(Context* ctx)
{
	scanf("%d", &ctx->n);
	for (int i = 0; i < ctx->n; ++i)
		scanf("%d", &ctx->v[i]);
}


void solve(Context* ctx)
{
	int s = 0;
	for (int i = 0; i < ctx->n; ++i)
		for (int j = 0; j < ctx->n; ++j)
			if(i!=j)
				s += ctx->v[i] * 10 + ctx->v[j];
	printf("%d\n", s);
}

int main()
{
	freopen("D:/Develop/GitRepos/MOOC/浙江大学/数据结构/201906/DataStructure/M2019秋C入门和进阶练习集/7-182.txt", "r", stdin);
	read_data(&context);
	solve(&context);
	return 0;
}
